# CONFIG OPTIONS
site_root = /home/schof/code/spbs-googlecode/branches/samplesite
code_root = /home/schof/code/spbs-googlecode/branches/code
m4bin = /usr/bin/m4
# END CONFIG OPTIONS



item_separator = ThisIsTheItemSeparator

# "all" is the target we call from spbs_publish.py to make the site.
all: markdownitems indexpages

markdownitems: $(site_root)/abadday.html $(site_root)/aniceday.html
indexpages: $(site_root)/index.html

$(site_root)/index.html: markdownitems
	SPBS_INDEXTEXT="$(site_root)/index.mkht" \
		$(m4bin) --prefix-builtins $(site_root)/components/index.m4 > $(site_root)/index.html

$(site_root)/aniceday.html: $(site_root)/aniceday.mkht
	SPBS_BODYCOPY="$(site_root)/aniceday.mkht" \
		$(m4bin) --prefix-builtins $(site_root)/components/master.m4 > $(site_root)/aniceday.html

$(site_root)/abadday.html: $(site_root)/abadday.mkht
	SPBS_BODYCOPY="$(site_root)/abadday.mkht" \
		$(m4bin) --prefix-builtins $(site_root)/components/master.m4 > $(site_root)/abadday.html

$(site_root)/aniceday.mkht: $(site_root)/aniceday.mkdn 
	$(code_root)/library/markdown $(site_root)/aniceday.mkdn > $(site_root)/aniceday.mkht
	head -n20 $(site_root)/aniceday.mkht >> $(site_root)/index.mkht
	echo >> $(site_root)/index.mkht ; echo $(item_separator) >> $(site_root)/index.mkht ; echo >> $(site_root)/index.mkht

$(site_root)/abadday.mkht: $(site_root)/abadday.mkdn 
	$(code_root)/library/markdown $(site_root)/abadday.mkdn > $(site_root)/abadday.mkht
	head -n20 $(site_root)/abadday.mkht >> $(site_root)/index.mkht
	echo >> $(site_root)/index.mkht ; echo $(item_separator) >> $(site_root)/index.mkht ; echo >> $(site_root)/index.mkht

clean:
	rm -f $(site_root)/aniceday.mkht
	rm -f $(site_root)/aniceday.html
	
	rm -f $(site_root)/abadday.mkht
	rm -f $(site_root)/abadday.html
	
	rm -f $(site_root)/index.html
	rm -f $(site_root)/index.mkht

